package com.example.administrator.foodrowfresh.models;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/5/4.
 */
public class TimeLimit {

    /**
     * success : ​1
     * data : {"FlashSale":[{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:27:15.207","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b2.39","DefaultMoney":"\u200b2.98","ProductId":"\u200b453","ProductName":"圆茄子","Weight":"500g","PictureId":"\u200b66","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_66_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:26:51.127","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b3.99","DefaultMoney":"\u200b4.68","ProductId":"\u200b55","ProductName":"西兰花","Weight":"500g","PictureId":"\u200b11005","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_11005_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:26:06.977","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b6.8","DefaultMoney":"\u200b7.99","ProductId":"\u200b66","ProductName":"精选荷兰豆","Weight":"500g","PictureId":"\u200b11114","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_11114_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:25:44.563","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b7.39","DefaultMoney":"\u200b8.9","ProductId":"\u200b204","ProductName":"小台农芒","Weight":"500g","PictureId":"\u200b1237","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_1237_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:25:27.340","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b7.7","DefaultMoney":"\u200b8.8","ProductId":"\u200b266","ProductName":"油桃","Weight":"500g","PictureId":"\u200b1033","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_1033_jpeg_160.jpeg"}],"MoreSale":"0001-01-01 00:00:00.000","CurrentSale":"2016-05-04 09:30:00.000","message":""}
     */

    private String success;
    /**
     * FlashSale : [{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:27:15.207","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b2.39","DefaultMoney":"\u200b2.98","ProductId":"\u200b453","ProductName":"圆茄子","Weight":"500g","PictureId":"\u200b66","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_66_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:26:51.127","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b3.99","DefaultMoney":"\u200b4.68","ProductId":"\u200b55","ProductName":"西兰花","Weight":"500g","PictureId":"\u200b11005","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_11005_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:26:06.977","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b6.8","DefaultMoney":"\u200b7.99","ProductId":"\u200b66","ProductName":"精选荷兰豆","Weight":"500g","PictureId":"\u200b11114","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_11114_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:25:44.563","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b7.39","DefaultMoney":"\u200b8.9","ProductId":"\u200b204","ProductName":"小台农芒","Weight":"500g","PictureId":"\u200b1237","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_1237_jpeg_160.jpeg"},{"Batch":"\u200b1","ProductVariantPriceName":"限时抢购","CreateTime":"2016-05-03 20:25:27.340","StartTime":"2016-05-04 09:30:00.000","EndTime":"2016-05-04 21:00:00.000","Discount":"特价","Unit":"斤","Standard":false,"PeriodMoney":"\u200b7.7","DefaultMoney":"\u200b8.8","ProductId":"\u200b266","ProductName":"油桃","Weight":"500g","PictureId":"\u200b1033","status":"\u200b2","time":"\u200b40546","servertime":"2016-05-04 09:44:13.773","image":"http://images4bj-app.34580.com/images/ProductImages/SH_Image_1033_jpeg_160.jpeg"}]
     * MoreSale : 0001-01-01 00:00:00.000
     * CurrentSale : 2016-05-04 09:30:00.000
     * message :
     */

    private DataBean data;

    public static TimeLimit objectFromData(String str) {

        return new Gson().fromJson(str, TimeLimit.class);
    }

    public static TimeLimit objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), TimeLimit.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<TimeLimit> arrayTimeLimitFromData(String str) {

        Type listType = new TypeToken<ArrayList<TimeLimit>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<TimeLimit> arrayTimeLimitFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<TimeLimit>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public String getSuccess() {
        return success;
    }

    public void setSuccess(String success) {
        this.success = success;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * Batch : ​1
         * ProductVariantPriceName : 限时抢购
         * CreateTime : 2016-05-03 20:27:15.207
         * StartTime : 2016-05-04 09:30:00.000
         * EndTime : 2016-05-04 21:00:00.000
         * Discount : 特价
         * Unit : 斤
         * Standard : false
         * PeriodMoney : ​2.39
         * DefaultMoney : ​2.98
         * ProductId : ​453
         * ProductName : 圆茄子
         * Weight : 500g
         * PictureId : ​66
         * status : ​2
         * time : ​40546
         * servertime : 2016-05-04 09:44:13.773
         * image : http://images4bj-app.34580.com/images/ProductImages/SH_Image_66_jpeg_160.jpeg
         */

        private List<FlashSaleBean> FlashSale;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public List<FlashSaleBean> getFlashSale() {
            return FlashSale;
        }

        public void setFlashSale(List<FlashSaleBean> FlashSale) {
            this.FlashSale = FlashSale;
        }

        public static class FlashSaleBean {
            private String Batch;
            private String ProductVariantPriceName;
            private String CreateTime;
            private String StartTime;
            private String EndTime;
            private String Discount;
            private String Unit;
            private boolean Standard;
            private String PeriodMoney;
            private String DefaultMoney;
            private String ProductId;
            private String ProductName;
            private String Weight;
            private String PictureId;
            private String status;
            private String time;
            private String servertime;
            private String image;

            public static FlashSaleBean objectFromData(String str) {

                return new Gson().fromJson(str, FlashSaleBean.class);
            }

            public static FlashSaleBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), FlashSaleBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<FlashSaleBean> arrayFlashSaleBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<FlashSaleBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<FlashSaleBean> arrayFlashSaleBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<FlashSaleBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public String getBatch() {
                return Batch;
            }

            public void setBatch(String Batch) {
                this.Batch = Batch;
            }

            public String getProductVariantPriceName() {
                return ProductVariantPriceName;
            }

            public void setProductVariantPriceName(String ProductVariantPriceName) {
                this.ProductVariantPriceName = ProductVariantPriceName;
            }

            public String getCreateTime() {
                return CreateTime;
            }

            public void setCreateTime(String CreateTime) {
                this.CreateTime = CreateTime;
            }

            public String getStartTime() {
                return StartTime;
            }

            public void setStartTime(String StartTime) {
                this.StartTime = StartTime;
            }

            public String getEndTime() {
                return EndTime;
            }

            public void setEndTime(String EndTime) {
                this.EndTime = EndTime;
            }

            public String getDiscount() {
                return Discount;
            }

            public void setDiscount(String Discount) {
                this.Discount = Discount;
            }

            public String getUnit() {
                return Unit;
            }

            public void setUnit(String Unit) {
                this.Unit = Unit;
            }

            public boolean isStandard() {
                return Standard;
            }

            public void setStandard(boolean Standard) {
                this.Standard = Standard;
            }

            public String getPeriodMoney() {
                return PeriodMoney;
            }

            public void setPeriodMoney(String PeriodMoney) {
                this.PeriodMoney = PeriodMoney;
            }

            public String getDefaultMoney() {
                return DefaultMoney;
            }

            public void setDefaultMoney(String DefaultMoney) {
                this.DefaultMoney = DefaultMoney;
            }

            public String getProductId() {
                return ProductId;
            }

            public void setProductId(String ProductId) {
                this.ProductId = ProductId;
            }

            public String getProductName() {
                return ProductName;
            }

            public void setProductName(String ProductName) {
                this.ProductName = ProductName;
            }

            public String getWeight() {
                return Weight;
            }

            public void setWeight(String Weight) {
                this.Weight = Weight;
            }

            public String getPictureId() {
                return PictureId;
            }

            public void setPictureId(String PictureId) {
                this.PictureId = PictureId;
            }

            public String getStatus() {
                return status;
            }

            public void setStatus(String status) {
                this.status = status;
            }

            public String getTime() {
                return time;
            }

            public void setTime(String time) {
                this.time = time;
            }

            public String getServertime() {
                return servertime;
            }

            public void setServertime(String servertime) {
                this.servertime = servertime;
            }

            public String getImage() {
                return image;
            }

            public void setImage(String image) {
                this.image = image;
            }
        }
    }
}
